'use strict';
import * as Koa from 'koa';
import { router, prefix } from '../middleware/router';
import { response } from '../middleware/result';
import { customer_orderService } from '../service/customer_order';
import { userwinhistoryService } from '../service/userwinhistory';

/** 订单API对象 */
@prefix('order')
class Customer_orderController {
    /**
     * 
     * @api {post} /order/query  查询我的订单记录-小程序
     * @apiDescription 查询我的订单记录
     * @apiName query
     * @apiParam (参数) {String} offset   页码
     * @apiParam (参数) {String} limit    每页显示条数
     * @apiParam (参数) {String} token   用户标识token
     * @apiParam (参数) {Number} type   查询类型，type:1代表消费记录(默认为1可不传)； type:2代表只看酒币
     * @apiSampleRequest /order/query
     * @apiGroup order
     * @apiVersion 3.0.0
     */
    @router('/query', { method: 'post' })
    async query(ctx: Koa.Context) {
        let result = await customer_orderService.query(ctx.request.body);
        response(ctx, result);
    }
    /**
     * 
     * @api {post} /order/queryall  查询订单记录(PC)
     * @apiDescription 查询订单记录
     * @apiName queryall
     * @apiParam (参数) {String} offset   页码
     * @apiParam (参数) {String} limit    每页显示条数
     * @apiParam (参数) {String} uid   用户id
     * @apiParam (参数) {String} mid   商户id
     * @apiParam (参数) {String} starttime 支付开始时间
     * @apiParam (参数) {String} endtime   支付结束时间
     * @apiSampleRequest /order/queryall
     * @apiGroup order
     * @apiVersion 2.0.0
     */
    @router('/queryall', { method: 'post' })
    async queryall(ctx: Koa.Context) {
        let result = await customer_orderService.queryall(ctx.request.body);
        response(ctx, result);
    }

    @router('/querybymid', { method: 'post' })
    async querybymid(ctx: Koa.Context) {
        let result = await customer_orderService.querybymid(ctx.request.body);
        response(ctx, result);
    }

    

    @router('/querybymerchantid', { method: 'post' })
    async querybymerchantid(ctx: Koa.Context) {
        let result = await customer_orderService.querybymerchantid(ctx.request.body);
        response(ctx, result);
    }

    @router('/getuserwinhis', { method: 'post' })
    async getuserwinhis(ctx: Koa.Context) {
        let result = await userwinhistoryService.getuserwinhis(ctx.request.body);
        response(ctx, result);
    }
}